import 'package:flutter/material.dart';
import '../widget/my_swiper.dart';
import '../widget/my_listview.dart';

//轮播图项对象
class SwiperPic {
  String title;
  String url;
  String path;
  SwiperPic(this.title, this.url, this.path);
}

class Home extends StatefulWidget {
  const Home({Key? key}) : super(key: key);

  @override
  _HomeState createState() => _HomeState();
}

class _HomeState extends State<Home> {
  late List<SwiperPic> list = [];

  @override
  void initState() {
    list..add(SwiperPic('图一','http://www.baidu.com','images/swiper1.jpg'))
    ..add(SwiperPic('图二','http://www.baidu.com','images/swiper2.jpg'))
    ..add(SwiperPic('图三','http://www.baidu.com','images/swiper3.jpg'))
    ..add(SwiperPic('图四','http://www.baidu.com','images/swiper4.jpg'))
    ..add(SwiperPic('图五','http://www.baidu.com','images/swiper5.jpg'));
    super.initState();
  }
  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        SizedBox(
          width: MediaQuery.of(context).size.width,
          height: 150.0,
          child: MySwiper(list: list,)
        ),
        Expanded(
          flex: 1,
          child: MyListView(),
        )
      ],
    );
  }
}
